namespace EFS.Common.Generators.Abstract
{
	public abstract class Element : EFS.Common.Generators.Abstract.Interfaces.IElement
	{
		/// Used pool
		public abstract EFS.Common.Generators.Abstract.Interfaces.Characters.IPool Pool
		{ get; }

		/// Generate element
		public System.String New(System.Int32 length)
		{
			// check range
			EFS.Common.Verify.PositiveNumber(length, "length");

			// check pool
			EFS.Common.Verify.Reference(Pool, "Pool");

			// generate 
			System.Text.StringBuilder sb = new System.Text.StringBuilder();
			while (length > 0)
			{
				sb.Append(Pool.Rand());
				length--;
			}

			// done
			return sb.ToString();
		}
	}
}
